<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1" width="50%">
  <caption>个人信息</caption>
  <tr><td>照片:</td><td id="head_td"></td></tr>
  <tr><td>姓名:</td><td id="name_td"></td></tr>
  <tr><td>年龄:</td><td id="age_td"></td></tr>
  <tr><td>好友:</td><td id="friend_td"></td></tr>
</table>
<input type="button" value="请求数据" onclick="f()">
<script>
    let headTd = document.querySelector("#head_td");
    let nameTd = document.querySelector("#name_td");
    let ageTd = document.querySelector("#age_td");
    let friendTd = document.querySelector("#friend_td");
    function f() {
        //准备数据  假设数据是从服务器请求回来的数据
        let person = {name:"苍老师",age:"18",
            url:"a.jpg",friends:["传奇哥","克晶姐","我自己"]}
        //把数据显示到页面中
        nameTd.innerText = person.name;
        ageTd.innerText = person.age;
        //创建图片标签
        let img = document.createElement("img");
        //设置图片显示的内容
        img.src = person.url;
        img.width=100;
        //把图片标签装进td
        headTd.append(img);

        //创建无序列表
        let ul = document.createElement("ul");
        //遍历好友数组
        for (let friend of person.friends) {
            //创建li
            let li = document.createElement("li");
            li.innerText = friend;
            //把li添加到ul里面
            ul.append(li);
        }
        //把ul添加到td里面
        friendTd.append(ul);
    }
</script>
</body>
</html>